package com.yygo.jobs;

import com.yygo.model.LoanPerson;
import com.yygo.model.LoanRequest;
import com.yygo.model.Rule;
import com.yygo.model.enums.IDType;
import com.yygo.service.LoanRequestManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by tiansha on 2015/7/4.
 */
@Component("D203")
public class D203 implements RuleProcessor {

    @Autowired
    private LoanRequestManager loanRequestManager;

    @Override
    public Rule process(LoanRequest loanRequest) {
        LoanPerson requestPerson = loanRequest.getRequestPerson();
        LoanPerson coPerson = loanRequest.getCoPerson();
        if ((requestPerson.getIdType().equals(IDType.Passport) || requestPerson.getIdType().equals(IDType.HKMT)) &&
                (coPerson != null && (coPerson.getIdType().equals(IDType.Passport) || coPerson.getIdType().equals(IDType.HKMT)))) {
            Rule rule = new Rule("D203", "主、共贷均非中国公民，请提供本地稳定工作担保人");
            return rule;
        }
        return null;
    }

}